//
//  BGRootViewController.swift
//  Billing
//
//  Created by Dale on 17/4/19.
//  Copyright © 2017年 Nari. All rights reserved.
//

import UIKit

class BGRootViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        let submitVC = BGSubmitViewController(nibName: "BGSubmitViewController", bundle: Bundle.main)
        submitVC.tabBarItem.image = UIImage(named: "submit")
        submitVC.tabBarItem.title = "提交"
        let submitNVC = BCNavigationController(rootViewController: submitVC)
        
        let recordVC = BGRecordViewController(nibName:"BGRecordViewController", bundle:Bundle.main)
        recordVC.tabBarItem.image = UIImage(named: "record")
        recordVC.tabBarItem.title = "账单"
        let recordNVC = BCNavigationController(rootViewController: recordVC)

        let setVC = BCSettingViewController()
        setVC.tabBarItem.image = UIImage(named: "set")
        setVC.tabBarItem.title = "设置"
        let setNVC = BCNavigationController(rootViewController: setVC)
        
        self.viewControllers = [submitNVC, recordNVC, setNVC]
        
        if  isHasNewVersion {
            self.tabBar.showBadge(onItemIndex: 2)
        } else {
            self.tabBar.hideBadge(onItemIndex: 2)
        }
        self.tabBar.tintColor = UIColor(red: 28.0/255, green: 202.0/255, blue: 147.0/255,
                                                     alpha: 1)
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
